package com.Inter.T01;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class I01 {
    public static void main(String[] args) throws IOException {
        // 创建对象
        DatagramSocket ds = new DatagramSocket(10011);
        // 创建数据包
        byte[] bytes = new byte[1024];
        DatagramPacket dp = new DatagramPacket(bytes, bytes.length);
        while (true) {
            // 读取数据
            ds.receive(dp);
            // 解析数据
            String data = new String(dp.getData(),0,dp.getLength());
            System.out.println(data);
            if(data == "886"){
                break;
            }
        }
        // 释放资源
        ds.close();
    }
}
